<?php
/*
$Id: qbi_create.php,v 2.10 2005/05/08 al Exp $

Quickbooks Import QBI
contribution for osCommerce
ver 2.10 May 8, 2005
(c) 2005 Adam Liberman
www.libermansound.com
info@libermansound.com
Please use the osC forum for support.
Released under the GNU General Public License

    This file is part of Quickbooks Import QBI.

    Quickbooks Import QBI is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    Quickbooks Import QBI is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Quickbooks Import QBI; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

require('includes/application_top.php');
require(DIR_WS_LANGUAGES . $language . '/qbi_general.php');
require(DIR_WS_LANGUAGES . $language . '/orders.php'); // needed for email text
// Now read new configuration
require_once(DIR_WS_INCLUDES . 'qbi_version.php');
require_once(DIR_WS_INCLUDES . 'qbi_definitions.php');
require_once(DIR_WS_FUNCTIONS . 'qbi_functions.php');
require_once(DIR_WS_CLASSES . 'qbi_classes.php');


?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<link rel="stylesheet" type="text/css" href="includes/qbi_styles.css">
<script type="text/javascript" src="includes/general.js"></script>
<script type="text/javascript" src="includes/menu.js"></script>
<script type="text/javascript"><!--
popUpWin=0;

function popUpWindow(URLStr, left, top, width, height){

  if(popUpWin)

  {

    if(!popUpWin.closed) popUpWin.close();

  }

  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');

}
//--></script>
</head>
<body bgcolor="#FFFFFF">
<div id="spiffycalendar" class="text"></div>
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="2" cellpadding="2">
  <tr>
    <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
    </table></td>
<!-- body_text //-->
    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
      <tr>
        <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
            <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td>
<table>
<!-- <form action="<?php echo FILENAME_QBI_CONFIG ?>" method="post" name="qbi_config" id="qbi_config"> -->
<?php
echo tep_draw_form('qbi_config', FILENAME_QBI_CONFIG, tep_get_all_get_params(array('action','qbi_config'), 'post', '', 'SSL') . 'action=update_order', 'post', '', 'SSL');

        if (isset($_GET[tep_session_name()])) {
          echo tep_draw_hidden_field(tep_session_name(), $_GET[tep_session_name()]);
          $session_id_temp =  $_GET[tep_session_name()];
        }
require(DIR_WS_INCLUDES . 'qbi_engine_orders_new.php');
require(DIR_WS_INCLUDES . 'qbi_engine_cust_new.php');
require(DIR_WS_INCLUDES . 'qbi_engine_prod.php');

echo"<div class=\"createhead\">Create orders iif file for download</div><button onclick=\"popUpWindow('qbi_create_cron.php?osCAdminID=' . $session_id_temp ,','100','150','600','250')\">Create Orders</button><br><br>\n";
// echo"<div class=\"createhead\">Create orders iif file for download</div><button onclick=\"popUpWindow('qbi_create_cron.php?osCAdminID=' . $session_id_temp ,'100','150','600','250')\">Create Orders</button><br><br>\n";

// echo"<div class=\"createhead\">Create orders iif file for download</div><button onclick=\"popUpWindow(\'' .  (HTTP_SERVER . DIR_WS_ADMIN . 'qbi_create_cron.php?osCAdminID=' . $session_id_temp) . '?' . (tep_get_all_get_params(array('oID'),'100','150','600','250')\">Create Orders</button><br><br>\n";

//echo"<div class=\"createhead\">Create ALL orders iif file for download</div><a href=\"qbi_create_cron.php?osCAdminID=' . $session_id_temp ,\" target=_blank>Create Orders</a><br><br>\n";

// Orders
for ($i=1; $i<=0; $i++) {
  $iif_form=new iif_form;
  $iif_form->where_clause("qbi_imported='".$i."'");
  if ($i==0 AND ORDERS_STATUS_IMPORT!=0) $iif_form->where_clause("orders_status='".ORDERS_STATUS_IMPORT."'");
  $iif_form->form_make('orders','orders_id','date_purchased',$i);
  echo $iif_form->form_display();
}

// Products
for ($i=0; $i<=2; $i++) {
  $iif_form=new iif_form;
  $iif_form->where_clause("qbi_imported='".$i."'");
  if (ITEM_ACTIVE==1) $iif_form->where_clause("products_status='1'");
  $iif_form->form_make('products','products_id','products_date_added',$i);
  echo $iif_form->form_display();
}

// Customers
$iif_form=new iif_form;
$iif_form->form_make('customers','customers_id','',2);
echo $iif_form->form_display();
?>
</form></table>
          </tr>
        </table></td>
      </tr>

    </table></td>
<!-- body_text_eof //-->
  </tr>

</table></form>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
